def guess(num):
    if num == pick:
        return 0
    elif num > pick:
        return -1
    elif num < pick:
        return 1
n = 2
pick = 2
left=0
right=n

while True:
    if guess((left+right)//2)==-1:
        right=(left+right)//2

    elif guess((left+right)//2)==1:
        left=(left+right)//2
    else:
        print((left+right)//2)
        break